import prometheus_client as pc

REQUEST_LATENCY = pc.Summary('request_latency_seconds', 'Request latency')
ERROR_COUNTER = pc.Counter('errors_total', 'Total errors')

@REQUEST_LATENCY.time()
def process_request(request):
    try:
        # 处理请求
        pass
    except Exception:
        ERROR_COUNTER.inc()